<?php
$conn = odbc_connect ($DSN, "", "");

function odbcFetch($res) {
  $row = array();
  $result = array();
  if ($result = odbc_fetch_row($res)) {
    $nf = odbc_num_fields($res) + 1;
    for($count=1; $count < $nf; $count++) {
      $field_name = odbc_field_name($res, $count);
      $field_value = odbc_result($res, $count);
      //$row[$count] = $field_value;
      $row[$field_name] = $field_value;
    }
    return $row;
  }
}

function getData($SQL, &$data) {
  global $conn;
//  print $SQL;
  $ret1 = odbc_exec($conn, $SQL);
  if ($data = odbcFetch($ret1)) {
    return 1;
  }
  else {
    return -1;
  }
}

function getMultData($SQL, &$data) {
  global $conn;
//  print $SQL;
  $ret_code = 0;
  $ret1 = odbc_exec($conn, $SQL);
  while ($row = odbcFetch($ret1)) {
    $data[$ret_code] = $row;
    $ret_code++;
  }
  return $ret_code;
}

function insertRecord($SQL) {
  global $conn;
  $ret1 = odbc_exec($conn, $SQL);
}
?>